#ifndef _STATE_MANAGER_H
#define _STATE_MANAGER_H

#include <list>
#include "State.h"
#include "SFML\Graphics.hpp"

class RenderManager;
class InputManager;
class StateManager
{
public:
	StateManager(std::shared_ptr<InputManager> inputManager);
	~StateManager(void);

	void update();
	void draw(RenderManager* renderManager);
	void stateTransition(float direction, bool loadQueuedStates = false);

	void queueState(State* state, bool active);
	void addState(State* state, bool active);
	void removeState(State* state);

	void setInputUpdate(bool value);						// disable/enable input for all states
	void setInputUpdate(const std::string& id, bool value);	// disable/enable input for a specific state
	void setUpdateState(bool value);
	void setUpdateState(const std::string& id, bool value);	// update
	void setDrawState(bool value);
	void setDrawState(const std::string& id, bool value);	// rendering			
	void setActiveState(bool value);						// disable/enable all states
	void setActiveState(const std::string& id, bool value);	// disable/enable specific a state
	void skipUpdateCycle(const std::string& id, short cycles);

private:
	void loadQueuedStates();
	std::shared_ptr<InputManager> _inputManager;

	sf::Sprite _blank;
	std::list<State*> _states;
	std::list<State*> _queue;
	std::vector<State*> _removeList;
	sf::Color _alpha;
	bool _transition;
	float _direction;
	float _virtualAlpha;
	float _alphaTransition;
	bool _loadQueuedStates;
};

#endif // _STATE_MANAGER_H

